package Threading;

public class Demo22 {

    public static void main(String[] args) {
        Thread thread=new Thread(()->{
            while(true){
                System.out.println("hello");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        },"这是我的线程");

        thread.start();
        System.out.println(thread.getId());
        System.out.println(thread.getName());
        System.out.println(thread.getPriority());
        System.out.println(thread.isDaemon());   //是否为后台线程
        System.out.println(thread.getState());   //获取线程的状态
        System.out.println(thread.isAlive());    //线程是否存活
        System.out.println(thread.isInterrupted()); //线程是否被中断
        System.out.println("==================");


    }
}
